// 问答历史记录
export interface QAHistory {
  id: number;
  question: string;
  answer: string;
  knowledgeBaseId: number;
  knowledgeBaseName?: string;
  createTime: string;
  sources: Source[];
  userId: number;
}

// 问答请求
export interface QARequest {
  question: string;
  knowledgeBaseId: number;
  topK?: number;
  conversationId?: number;
}

// 问答响应
export interface QAResponse {
  id: number;
  question: string;
  answer: string;
  sources: Source[];
  createTime: string;
}

// 资源来源
export interface Source {
  documentId: number;
  documentName: string;
  content: string;
  similarity: number;
  page?: number;
}

// 会话
export interface Conversation {
  id: number;
  title: string;
  knowledgeBaseId: number;
  knowledgeBaseName?: string;
  messages: Message[];
  createTime: string;
  updateTime: string;
  userId: number;
}

// 消息
export interface Message {
  id: number;
  conversationId: number;
  role: 'user' | 'assistant' | 'system';
  content: string;
  createTime: string;
  sources?: Source[];
}

// 会话查询请求
export interface ConversationQuery {
  page: number;
  pageSize: number;
  knowledgeBaseId?: number;
  searchTerm?: string;
  sortBy?: 'createTime' | 'updateTime';
  sortOrder?: 'asc' | 'desc';
}

// 会话响应
export interface ConversationResponse {
  data: Conversation[];
  total: number;
  page: number;
  pageSize: number;
}